<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 路♥克
  Date: 2017/12/4
  Time: 21:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<nav class="navbar navbar-default navbar-fixed-top">
    <div class="container">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/Web/WebGoodsInfo/findAllGoodsInfo">亚细亚</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul id="yxynav" class="nav navbar-nav navbar-left">

                <li><a href="/Web/WebGoodsInfo/findAllGoodsInfo">首页 <span class="sr-only">(current)</span></a></li>
                <li><a href="/web/productList.jsp">产品</a></li>
                <li><a href="/web/aboutUs.jsp">关于我们</a></li>
                <li><a href="javascript:void(0)" data-toggle="modal" data-target="#login">登录</a></li>
                <c:if test="${not empty user}">
                    <li><a href="/web/orderList.jsp" >个人中心</a></li>
                </c:if>
            </ul>

            <form class="navbar-form navbar-right">
                <%--<div class="form-group">--%>
                    <%--<input type="text" class="form-control" placeholder="Search">--%>
                <%--</div>--%>
                    <div class="col-sm-10">
                        <div class="input-group">
                            <input id="key" type="text" name="phoneCode"  class="form-control" id="validate" placeholder="Search">
                            <span class="input-group-btn" >
                                    <button style="margin-top: 15%;background-color: #ff752d;color: white" id="Search" class="btn btn-default" type="button" >搜索</button>
                            </span>
                        </div><!-- /input-group -->
                    </div>
            </form>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
<script>
    $(function () {
        $("#Search").click(function () {
//            $.ajax({
//                type: "POST",
//                url: "/web/productList.jsp",
//                data:{key:$("#key").val()}
//            });
            window.location.assign(encodeURI("/web/productList.jsp?key="+$("#key").val()));
        });
//        $(".goods").each(function () {
//            $(this).click(function () {
//                var gid = $(this).children().children("input[type='hidden']").val();
//                window.location.href="/Web/WebGoodsInfo/findGoodsDetails?goodsId="+gid;
//            });
//        });
        $(document).on("click",".goods",function () {
            var gid = $(this).children().children("input[type='hidden']").val();
            window.location.href="/Web/WebGoodsInfo/findGoodsDetails?goodsId="+gid;
        });
    });
</script>